/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package nadesicoi

import groovy.sql.*;
import groovy.inspect.swingui.*
/**
 *
 * @author Adan
 */
class Db {

    static def asignarA(serv) {
        serv.getRows = getRows
    }

        static def getRows = { query ->
        def salida = ""
        try {
        def db   = Sql.newInstance("jdbc:mysql://localhost/omoikane?user=root&password=", "root", "", "com.mysql.jdbc.Driver")
        def rows = db.rows(query)
            db.close()
            salida = rows
        } catch(e) {Consola.error( "[Error: ${e.message}]",e); throw new Exception("Error al Poblar Tabla")}
        salida
    }

}

